/**
 * 
 */
package nc.impl.am.leasehold;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;

import nc.jdbc.framework.processor.BaseProcessor;

/**
 * @author yangjl
 * 
 */
public class MapResultProcessor extends BaseProcessor {
	private int keyIndex = 1;
	private int valueIndex = 2;

	public MapResultProcessor() {

	}

	public MapResultProcessor(int keyIndex, int valueIndex) {
		this.keyIndex = keyIndex;
		this.valueIndex = valueIndex;
	}

	@Override
	public Object processResultSet(ResultSet rs) throws SQLException {
		Map map = new HashMap();
		while (rs.next()) {
			map.put(rs.getObject(keyIndex), rs.getObject(valueIndex));
		}
		return map;
	}

}
